
<template>
  <div>
    <h2>父组件</h2>
    <Child @from-child="handleFromChild" />
    <p>接收到来自子组件的消息：{{ childMsg }}</p>
  </div>
</template>

<script setup>
import { ref } from 'vue';
import Child from './Child.vue';

const childMsg = ref('');

function handleFromChild(msg) {
  childMsg.value = msg;
}
</script>
